﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//using SIMA.Entities;
using SIMA.Core.Data.Collection;
using System.ComponentModel;
using SIMA.Core.Data.Access;
using SIMA.Controls;

namespace SIMA.Client.Auxiliars.MVVM
{
    public class PrincipalMVVM//:INotifyPropertyChanged,IDisposable
    {
        //#region Consts

        //private const string CONNECTIONSTRING = "Data Source=.;Initial Catalog=SIMA;Integrated Security=True";

        //#endregion

        //#region Fields

        //private T_C_Usuario usuario;
        //private T_C_Perfil perfil;
        //private List<T_C_Permiso> permisos;
        //private SmartContainer<T_C_Usuario> usuarioSmart;
        //private SmartContainer<T_C_Perfil> perfilSmart;
        //private SmartContainer<T_C_PermisosXPerfil> permisosPerfilSmart;
        //private SmartContainer<T_C_Permiso> permisoSmart;
        //private bool isBusy=false;
        //private string operationDescription = string.Empty;

        //#endregion

        //#region Properties

        //public bool IsBusy
        //{
        //    get
        //    {
        //        return isBusy;
        //    }
        //    set
        //    {
        //        isBusy = value;
        //        OnProperyChanged("IsBusy");
        //    }
        //}

        //public string OperationDescription
        //{
        //    get
        //    {
        //        return operationDescription;
        //    }
        //    set
        //    {
        //        operationDescription = value;
        //        OnProperyChanged("OperationDescription");
        //    }
        //}

        //#endregion

        //#region Events
        
        //#endregion

        //#region Contructor

        //#endregion

        //#region Public Methods

        //#endregion

        //#region Private Methods

        //private void Init()
        //{
            
        //    DataAccess.SetConnection(SIMA.Core.Enums.AccessType.FromString, CONNECTIONSTRING);
        //    usuarioSmart = new SmartContainer<T_C_Usuario>(true);
        //    usuarioSmart.Failed += new EventHandler<SIMA.Core.EventArgs.FailedEventArgs>(usuarioSmart_Failed);
        //    perfilSmart = new SmartContainer<T_C_Perfil>();
        //    permisosPerfilSmart = new SmartContainer<T_C_PermisosXPerfil>();
        //}

        //void usuarioSmart_Failed(object sender, SIMA.Core.EventArgs.FailedEventArgs e)
        //{
        //    SIMAMessageBox.Show(e.InstantFailed.ToLongTimeString(), e.ExceptionOcurred.Message, e.ExceptionOcurred.StackTrace, SIMAMessageBoxButtons.OK, SIMAMessageBoxImage.Error);
        //}

        //private string FormatValidateUser(T_C_Usuario usr)
        //{
        //    StringBuilder strBuilder = new StringBuilder();
        //    strBuilder.Append("Id_Usuario = ");
        //    strBuilder.Append(usr.Id_Usuario);
        //    return strBuilder.ToString();
        //}

        //private bool OnValidate()
        //{
        //    bool result;

        //    return true;
        //}

        //#endregion

        //#region Destructor

        //~PrincipalMVVM()
        //{
        //    this.Dispose();
        //}

        //#endregion

        //#region Miembros de INotifyPropertyChanged

        //public event PropertyChangedEventHandler PropertyChanged;

        //private void OnProperyChanged(string property)
        //{
        //    if (PropertyChanged != null)
        //    {
        //        PropertyChanged(this, new PropertyChangedEventArgs(property));
        //    }
        //}

        //#endregion

        //#region Miembros de IDisposable

        //public void Dispose()
        //{
        //    GC.SuppressFinalize(this);
        //}

        //#endregion
    }
}
